/*
 * @Author: chen haoxuan
 * @Date: 2021-05-24 21:51:32
 * @LastEditTime: 2021-05-24 22:03:19
 */
// 4.7.2 重载流提取运算符 ">>"
#include<iostream>
using namespace std;
class Complex
{
    public:
        friend ostream& operator <<(ostream& ,Complex &);
        friend iostream& operator >>(iostream& ,Complex &);
    private:
        double real;
        double imag;
};
ostream& operator <<(ostream& output,Complex &c)
{
    output<<"("<<c.real<<"+"<<c.imag<<"i)"<<endl;
    return output;
}
istream& operator >>(istream& input,Complex& c)
{
    cout<<"input real part and imaginary part of complex number:";
    input>>c.real>>c.imag;
    return input;
}
int main()
{
    Complex c1,c2;
    cin>>c1>>c2;
    cout<<"c1= "<<c1<<endl;
    cout<<"c2= "<<c2<<endl;
    system("pause");
    return 0;
}